<template>

  <div class="generalize-afresh">
    <div class="empty-box">
      <div class="img-box"><img src="./empty.png" class="empty" onclick="return false"/></div>
      <div class="tip">登录失败，请重试~</div>
    </div>

    <button type="button" class="success-afresh" @click="afreshLogin">重新登录</button>
  </div>

</template>

<script>
  import {baseUrl} from "../../../config/env";

  export default {
    name: "generalizeAfresh",
    methods: {
      afreshLogin() {
        this.axios.get(baseUrl + "/promotion/get_code").then((res) => {
          let resultObj = res.data;
          if (resultObj.code == 0) {
            let redirect = resultObj.data;
            let redirectUrl = redirect.split("get_access_token")[0] + "get_access_token?tag=" + (this.tag ? this.tag : '') + redirect.split("get_access_token")[1];
            window.location.href = redirectUrl;
          } else {
            this.$vux.toast.text(resultObj.msg, "middle");
          }
        }).catch(() => {
          this.$vux.toast.text("网络异常", "middle");
        });
      }
    }
  }
</script>

<style lang="stylus" scoped>
  @import "../../../assets/stylus/mixin.styl"
  .generalize-afresh
    fj(center, center)
    flex-direction: column
    wh(100%, auto)
    position: fixed
    top: 0
    left: 0
    right: 0
    bottom: 0
    .empty-box
      width: 4.773rem
      height: auto
      .img-box
        width: 100%
        height: 4.773rem
        .empty
          width: 100%
          height: 100%
      .tip
        display: flex
        justify-content: center
        margin-top: 0.387rem
        font-size: 0.373rem
        color: rgba(68, 68, 68, 1)
    .success-afresh
      margin-top: 1.2rem
      width: 8.453rem
      height: 1.173rem
      background: rgba(60, 175, 255, 1)
      border-radius: 0.107rem
      font-size: 0.44rem
      color: rgba(255, 255, 255, 1)
</style>
